$(function(){
    let form = layui.form
    //获取存储的id
   let idset =  localStorage.getItem("id")
   //快速表单赋值
  $.ajax({
      url:'admin/users/' + idset,
      type:'GET',
      success:function(res){
          console.log(res)
          form.val("nameTest",  res.data);
      }
  })

$('#sub').on('click',function(e){
    e.preventDefault()
    let data = $('.setForm').serialize()
   $.ajax({
       url:'admin/users',
       type:'PUT',
       data,
       success:function(res){
          if(res.status !==0){
              return "更改用户信息失败"
          }
        layer.msg(res.message)
       }
   })
  })
})